package cn.jobstart.controller;

import cn.jobstart.dto.TalentPortraitDTO;
import cn.jobstart.dto.TalentPortraitPageDTO;
import cn.jobstart.export.TalentPortraitDomainExport;
import cn.jobstart.modelExt.TalentPortraitExt;
import cn.jobstart.pubInter.IBaseService;
import cn.jobstart.pubInter.exception.SkException;
import cn.jobstart.searchExt.TalentPortraitSearchExt;
import cn.jobstart.service.ITalentPortraitService;
import cn.jobstart.vo.TalentPortraitDetailDomainVO;
import cn.jobstart.vo.TalentPortraitDetailVO;
import cn.jobstart.vo.TalentPortraitDomainVO;
import cn.jobstart.vo.TalentPortraitListVO;
import io.swagger.annotations.Api;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.HashSet;
import java.util.Set;

/**
 * @author sunke
 * @Date 2023-10-14 23:17:57
 * @description TalentPortraitController      人才画像
 */
@Api(tags = "后台管理系统-人才画像相关", description = "人才画像相关接口")
@RestController(value = "talentPortraitRestfulController")
@RequestMapping("/talentPortrait/")
@Validated
public class TalentPortraitController extends ApiManageController<TalentPortraitDTO, TalentPortraitPageDTO, TalentPortraitExt, TalentPortraitSearchExt, TalentPortraitDomainVO, TalentPortraitDetailDomainVO, TalentPortraitDetailVO, TalentPortraitListVO, String> {

    @Resource(name = "talentPortraitService")
    private ITalentPortraitService talentPortraitService;


    @Override
    public boolean beforePostAdd(TalentPortraitDTO dto, TalentPortraitExt domain, HttpServletRequest request, HttpSession session) throws SkException {
        domain.setAdminId(getJwtsUtil().getAdminId(request));
        domain.setAdminTruename(getJwtsUtil().getAdminTruename(request));
        return super.beforePostAdd(dto, domain, request, session);
    }

    @Override
    public IBaseService<TalentPortraitExt, TalentPortraitSearchExt, String> getBaseService() throws SkException {
        return talentPortraitService;
    }

    @Override
    public String getBaseRoute() {
        return "/talentPortrait/";
    }

    /**
     * 当前模板名称
     *
     * @return
     */
    @Override
    public String getModelName() {
        return "人才画像";
    }

    @Override
    public Class exportExcelClass() {
        return TalentPortraitDomainExport.class;
    }

    @Override
    public Set<String> totalMapSet() {
        Set totalMapSet = new HashSet();
        totalMapSet.add("count(talent_portrait.tp_id) as countNum");
        return totalMapSet;
    }


}